const app = getApp();
Page({
    data: {
        show:false
        },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        let that=this;
        console.log('------mine-------');
        console.log(options);
        console.log('-------mine------');
        var parent_id=options.parent_id;
        if(parent_id!=undefined){
            this.setData({
                parent_id:parent_id
              })
              wx.setStorageSync('parent_id',parent_id);
        }else{
            parent_id = wx.getStorageSync('parent_id');
        
        }
        var open=wx.getStorageSync('open');
   
        if(open == ""){
            console.log('open is null')
            
            wx.navigateTo({
              url: '../login/index?parent_id='+parent_id,
            })
            
        }else{
            console.log('--mine----')
            console.log(open)
            console.log('----mine---')
        }
        wx.showShareMenu({
            menus: ['shareAppMessage'],
            success(res) {
              console.log(res)
            },
            fail(e) {
              console.log(e)
            }
          })
          wx.hideShareMenu({
              menus:['shareTimeline']
          })     
          let d=app.globalData;
          this.setData({
              open:open,
              platform:d.platform,    
              width:d.windowWidth,
              height:d.windowHeight,
              statusBarHeight:d.statusBarHeight,
              navHeight:d.navHeight,
              marginTop:d.navTitleTop,
              domain:d.domain,
              iUrl:d.iUrl,
              upUrl:d.upUrl
            })
    },
    goto:function(e){
        console.log(e);
        var url=e.currentTarget.dataset.url;
        var index=e.currentTarget.dataset.index;
        app.goto(url,index)
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */


        onShow() {
            var role=0;
            var tabIndex=2; 
            //this.update(role)
            //tabBar.updateIndex(this, tabIndex);
        } ,
      
    
      update(role) {     
         tabBar.updateRole(this,role);
     },
     onPageScroll(e){
        //console.log(e)
        var scrollTop = e.scrollTop;
        var show = 0 ;
        if(scrollTop>=60){
           show=1;
        }
        this.setData({
            show:show
        })
       },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})